﻿using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Collections.Generic;
using System.Text;
using PFM.Entities; 

namespace PFM.Services
{
    [ServiceContract(Namespace = "")]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class TranService : PFM.Services.ITranService
    {
        [OperationContract]
        public  Transaction[] GetTrans()
        {
            // Add your operation implementation here
            List<Transaction> Trans = new List<Transaction>();
            Random rand=new Random();
            for(int i=0;i<10;i++)
                Trans.Add(new Transaction{ 
                     Guid=Guid.NewGuid (),
                     Type=(int) TranType.DAY, 
                     Date = DateTime.Now.AddDays(rand.Next(10)),
                     Item = new Item{ Type=(int) ItemType .IN , Remark="Hello"},
                     NewPrice =rand.NextDouble()*100
                });
           
           
            return Trans.ToArray();
        }

        // Add more operations here and mark them with [OperationContract]
    }
}
